﻿using JetBrains.Annotations;
using MugenMvvmToolkit.Interfaces.ViewModels;

namespace MugenMvvmToolkit.Interfaces
{
    /// <summary>
    /// Represents the operation result navigation policy.
    /// </summary>
    public interface INavigationOperationResultPolicy
    {
        /// <summary>
        ///     Registers a callback to complete the result operation.
        /// </summary>
        /// <param name="targetViewModel">The navigated view model.</param>
        /// <param name="navigationResult">The current navigation result.</param>
        /// <param name="context">The current navigation context.</param>
        void RegisterOperationResultCallback([NotNull]IViewModel targetViewModel, [NotNull] INavigationResult navigationResult, [NotNull] INavigationContext context);

        /// <summary>
        ///     Tries to clear the operation result callback.
        /// </summary>
        void TryClearOperationResultCallback([CanBeNull]IViewModel targetViewModel, [NotNull] INavigationContext context);

        /// <summary>
        /// Removes the view model from cache.
        /// </summary>
        bool Clear([NotNull]IViewModel viewModel);

        /// <summary>
        /// Clears the all operation callbacks.
        /// </summary>
        void Clear();
    }
}